/**
 * Carnegie Mellon University
 * School of Computer Science
 * MSIT eBusiness Technology
 * 
 * Team 8 - Infinity (2011 Spring)
 * infinity-team8@googlegroups.com
 * 
 * Professor: Jeffrey L. Eppinger
 * Program Faculty: Sujata Telang
 */

package formbean;

import java.util.ArrayList;
import java.util.List;

import org.mybeans.form.FormBean;

public class EmployeeCreateFundForm extends FormBean {
	private String name;
	private String symbol;

	

	public String getName() {
		return name;
	}



	public void setName(String name) {
		this.name = name;
	}



	public String getSymbol() {
		return symbol;
	}



	public void setSymbol(String symbol) {
		this.symbol = symbol;
	}



	public List<String> getValidationErrors() {
		List<String> errors = new ArrayList<String>();

		if (name == null || name.length() == 0) {
			errors.add("Name is required");
		}
		
		if (name.matches(".*[<>\"].*")) {
			errors.add("Name may not contain angle brackets or quotes");
		}

		if (symbol == null || symbol.length() == 0) {
			errors.add("Symbol is required");
		}
		
		if (symbol.matches(".*[<>\"].*")) {
			errors.add("Symbol may not contain angle brackets or quotes");
		}
		
		if (symbol.length()>5) {
			errors.add("Symbol must be less or equal to a combination of five letters or numbers");
		}
		
		
		return errors;
	}
}
